package xyz.xtt.exchange.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import xyz.xtt.common.response.ApiResult;
import xyz.xtt.exchange.dto.MintPriceConfigItem;
import xyz.xtt.exchange.service.IConfigService;

/**
 * @author huqibo
 * @date 2025/03/20
 */
@Slf4j
@RequestMapping("/api/nft/exchange")
@RestController
public class ConfigController {
	@Autowired
	private IConfigService iConfigService;

	@Operation(summary = "获取个人铸造价格配置")
	@GetMapping("/config/getMintPriceConfig")
	public ApiResult<List<MintPriceConfigItem>> getPersonalMintPriceConfig() {
		log.info("/api/nft/exchange/config/getMintPriceConfig");
		return ApiResult.ok(iConfigService.getPersonalMintPriceConfig());
	}

	@Operation(summary = "获取个人铸造价格")
	@GetMapping("/calMintPrice")
	public ApiResult<String> calculatePersonalMintPrice(@RequestParam("mintNum") Integer mintNum) {
		return ApiResult.ok(iConfigService.calculatePersonalMintPrice(mintNum));
	}
}
